import chromadb

client = chromadb.Client()

collection = client.get_or_create_collection("my_collection")

collection.add(
    documents=["这是第一个文档", "这是第二个文档", "这是第三个文档"],
    # embeddings=[[0.1, 0.1, 0.1], [0.2, 0.2, 0.2], [0.3, 0.3, 0.3]],
    metadatas=[{"source": "doc1"}, {"source": "doc2"}, {"source": "doc3"}],
    ids=["id1", "id2", "id3"],
)

results = collection.query(
    query_texts=["文档"], n_results=1, where={"source": {"$eq": "doc2"}}
)
print(results)
